<template>
	<div class="newsinfo">
		<div class="title"><h5>{{newsinfoList.title}}</h5></div>
		<p class="subTitile"><span>发表时间:{{newsinfoList.add_time}}</span> <span>点赞:{{newsinfoList.click}}次</span></p>
		<hr>
		<div class="newsinfo-content" v-html="newsinfoList.content"></div>
		<commentView :id="id"></commentView>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui';
	import comments from "../comment/comments.vue"
	export default{
		data(){
			return{
				id:this.$route.params.id,
				newsinfoList:{}
			}
		},
		created(){
			this.addNewsInfo()
		},
		methods:{
			addNewsInfo(){
				this.$http.get('api/getnew/'+this.id).then(result=>{
					if(result.body.status===0){
						this.newsinfoList=result.body.message[0];
						console.log(this.newsinfoList)
					}else{
						Toast('获取数据失败');
					}
				})
			}
		},
		components:{
			"commentView":comments
		}
	};
</script>
<style lang="less" scoped>
		.newsinfo{
			padding: 0 5px;
			margin-bottom: 60px;
			.title{
				text-align: center;
				margin:10px 0;

				h5{
					font-size: 16px;
					color: red;
				}
			}
			.subTitile{
				display: flex;
				justify-content: space-between;
				color: blue;
			}
		}
</style>